package cn.vivi.nacos.controller;

import cn.vivi.nacos.client.PaymentClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("orders")
@RefreshScope // 支持动态刷新功能
public class OrderController {

    @Autowired
    private PaymentClient paymentClient;

    @Value("${user.name}")
    private String name;

    @GetMapping("{id}")
    public String hello(@PathVariable String id) {
        return paymentClient.hello(id) + " ==> " + name;
    }

}
